from tools_algorithm import *


class Solution:
    def longestContinuousSubstring(self, s: str) -> int:
        ans = cnt = 0

        def max(a, b):
            return a if a >= b else b

        for i, v in enumerate(s):
            if i == 0 or ord(v) - ord(s[i - 1]) != 1:
                cnt = 1
            else:
                cnt += 1
            ans = max(ans, cnt)
        return ans
